Certain memory devices store data in blocks of a certain size. When storing data to such a device, an entire block is typically written at once. Similarly, when reading data from such a device, an entire block is typically read at once. When a host device sends data to be written, or requests data to be read, in blocks of the same size, the system operates optimally. However, when the device operates on blocks of a first size, and the host operates on blocks of a second size, inefficiencies arise.
For example, in a magnetic disk drive, data may be stored in “sectors,” where each sector is an angular portion of an annular “track.” Data typically cannot be read or written from such a disk drive except in entire sectors. If the host wants to read data within a sector, the host sends a request to the drive controller, and the entire sector is read and reported back to the host. Similarly, if the host wants to modify data within a sector, the host sends to the drive controller a new version of the entire sector, to be written over the current sector contents. Each such read or write operation requires only one drive access—either to read the sector or to replace the sector, which usually requires only one physical pass over the sector, meaning only one disk revolution is required.
A common sector size has been 512 B, which means the sector includes 512 bytes of user data, plus overhead such as ECC and/or CRC information, sync marks, etc. More recently, disk drives with a sector size of 4 kB have been introduced. Each sector in one of these newer drives includes eight times as much user data (i.e., 4,096 bytes) with essentially the same amount of overhead. Therefore, the total overhead, for a disk of a given total size using 4 kB sectors, is about one-eighth of the overhead for a disk of the same total size using 512 B sectors.
However, many software applications, and even operating systems, continue to expect disk drive sectors of 512 B. This is typically handled by having the disk drive controller emulate 512 B operation. Thus, the host may request to read a certain 512 B sector. Such a sector does not actually exist, but is mapped to a portion of 4 kB sector. To fulfill the request, the drive controller reads the entire 4 kB sector into a buffer and returns to the host only the 512 B portion that the host requested. A read operation therefore results in virtually no loss of efficiency, as a single read operation is performed regardless of the sector size.
On the other hand, if the host wants to write a particular 512 B sector, the host sends that sector to the drive controller as in the past. However, as stated above, data can be written only in full sectors. In order to write the 512 B sector that the host wants to write, the drive controller must write the entire 4 kB physical sector of which the 512 B block is a portion. Even if somehow only the 512 B portion could be written, ECC, CRC, checksum, parity and/or other overhead data for the entire 4 kB sector would change, necessitating writing the entire sector. However, the host has not sent the full 4 kB sector to allow overwriting in a single operation as described above. Instead, the drive controller must read the 4 kB sector in question from the disk medium into a buffer, modify, in the buffer, the portion corresponding to the 512 B block which the host wants to write plus the modified overhead data, and then write the modified 4 kB sector back to the disk medium. This requires at least one (and generally only one) pass of the disk to read the 4 kB sector, and at least one (and generally only one) pass of the disk to write the 4 kB sector. Thus, about twice as many passes of the disk are required in emulation of write operations as compared to drives with native 512 B sectors.
In addition, if there is a failure of any kind at the disk during the write process, while that failure may be communicated to the host, the host will associate the failure only with the 512 B block that it addressed, not with other blocks in the physical disk drive sector in which the addressed block resided.